﻿'/*
' * FAHWatch7  Copyright Marvin Westmaas ( mtm )
' *
' * This program is free software; you can redistribute it and/or
' * modify it under the terms of the GNU General Public License
' * as published by the Free Software Foundation; version 2
' * of the License. See the included file GPLv2.TXT.
' * 
' * This program is distributed in the hope that it will be useful,
' * but WITHOUT ANY WARRANTY; without even the implied warranty of
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' * GNU General Public License for more details.
' * 
' * You should have received a copy of the GNU General Public License
' * along with this program; if not, write to the Free Software
' * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
' */
'/*	
Public Class clsAddClient
    Implements IDisposable

    Private WithEvents fAdd As New frmAddClient
    Public Event FormClosed()
    Private bAllowclose As Boolean = False
    Private Sub fAdd_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles fAdd.FormClosing
        Try
            If e.CloseReason = CloseReason.WindowsShutDown Then Exit Sub
            If Not bAllowclose Then
                e.Cancel = True
                fAdd.Hide()
                RaiseEvent FormClosed()
            End If
        Catch ex As Exception
            WriteError(ex.Message, Err)
        End Try
    End Sub
    Public ReadOnly Property IsFormVisible As Boolean
        Get
            If Not fAdd.Created Then Return False
            Return fAdd.Visible
        End Get
    End Property
    Public Sub CloseForm()
        fAdd.Close()
    End Sub
    'Private bInitialized As Boolean = False
    Public Sub ShowForm(Optional OwnerForm As Form = Nothing)
        Try
            'If Not bInitialized Then
            '    fAdd.Init()
            '    bInitialized = True
            'End If
            fAdd.Init(OwnerForm)
        Catch ex As Exception
            WriteError(ex.Message, Err)
        End Try
    End Sub


#Region "IDisposable Support"
    Private disposedValue As Boolean ' To detect redundant calls

    ' IDisposable
    Protected Overridable Sub Dispose(disposing As Boolean)
        If Not Me.disposedValue Then
            If disposing Then
                ' TODO: dispose managed state (managed objects).
                fAdd.Dispose()
            End If

            ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
            ' TODO: set large fields to null.
        End If
        Me.disposedValue = True
    End Sub

    ' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
    'Protected Overrides Sub Finalize()
    '    ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
    '    Dispose(False)
    '    MyBase.Finalize()
    'End Sub

    ' This code added by Visual Basic to correctly implement the disposable pattern.
    Public Sub Dispose() Implements IDisposable.Dispose
        ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region

End Class
